package org.spbsu.timetable.utils;

import org.spbsu.timetable.model.Lesson;
import org.spbsu.timetable.model.Pair;
import org.spbsu.timetable.model.Timetable;

public class Evaluator {
	public static Double evaluate(Lesson lesson,
			Pair<Integer, Integer> position, Timetable timetable) {
		// TODO write some code here
		return tooLate(position.getSecond(), timetable.getLessonsQnt()) + music(lesson, position);
	}

	private static Double tooLate(Integer lessonNumber, Integer maxLessons) {
		return 1.0 - (double) lessonNumber / maxLessons;
	}
	
	private static Double music(Lesson lesson, Pair<Integer, Integer> position) {
		if (lesson.getTitle().equals("Music")) {
			if (position.getFirst() < 3) {
				return 0.0;
			}
			return 1.0;
		}
		
		return 1.0;
	}

}
